<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <meta charset="UTF-8">
    <script src="<%=request.getContextPath()%>/resources/js/jquery-1.11.3.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/jquery-heima-0.0.1.js" ></script>
    <script>
        function del(pid){
            var a = confirm("确定删除吗?");
            if(a==true){
                HM.ajax("<%=request.getContextPath()%>/adminServlet","method=delProduct&pid="+pid,function(data){
                    if(data.code==1){
                        location.reload();
                    }else{
                        alert(data.message);
                    }
                });
            }
        }
    </script>
    <title>商品列表</title>
    <style type="text/css">
        .a_button_edit{
            background: url(<%=request.getContextPath()%>/resources/img/admin/i_edit.gif) no-repeat;
            display: inline-block;
            width: 18px;
            height: 18px;
        }
        .a_button_del{
            background: url(<%=request.getContextPath()%>/resources/img/admin/i_del.gif) no-repeat;
            display: inline-block;
            width: 18px;
            height: 18px;
        }
        .tr_odd{
            background-color: #CCCCCC;
        }
        .tr_even{
            background-color: #e6e6e6;
        }
        .prod_tr{
            text-align: center;
        }
        .prod_tr:hover{
            background-color: white;
        }
        .this{
            color: red;
        }
    </style>
</head>
<body>
<table cellSpacing="1" cellPadding="0" width="100%" align="center" bgColor="#f5fafe" border="0">
    <tbody>
    <tr>
        <td  align="center" bgColor="#afd1f3">
            <strong>用户列表</strong>
        </TD>
    </tr>
    <tr>
        <td id="pageProduct" align="center" bgColor="#f5fafe">
            <table cellspacing="0" cellpadding="1" bordercolor="gray" border="1" style=" WIDTH: 100%; WORD-BREAK: break-all;BORDER-COLLAPSE: collapse; WORD-WRAP: break-word">
                <tr style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3;text-align: center;">
                    <td width="20%">
                        序号
                    </td>
                    <td  width="9%">
                        账户名称
                    </td>
                    <td  width="9%">
                        账户密码
                    </td>
                    <td  width="8%">
                        用户名
                    </td>
                    <td  width="8%">
                        邮箱
                    </td>
                    <td width="8%">
                        生日
                    </td>
                    <td width="3%">
                        性别
                    </td>
                    <td width="5%">
                        激活状态
                    </td>
                    <td width="7%">
                        身份
                    </td>
                    <td >
                        备注
                    </td>
                    <td width="7%" >
                        操作
                    </td>
                </tr>

                <c:forEach items="${adminuser.list}" var="i" >
                    <tr class="tr_odd prod_tr">
                        <td width="20%">
                                ${i.uid}
                        </td>
                        <td width="9%">
                                ${i.username}
                        </td>
                        <td width="9%">
                                ${i.password}
                        </td>
                        <td width="8%">
                                ${i.name}
                        </td>
                        <td width="8%">
                                ${i.email}
                        </td>
                        <td width="8%">
                                ${i.birthday}
                        </td>
                        <td width="3%">
                                ${i.gender}
                        </td>

                        <td width="5%" style="padding: 0px;margin: 0px;">
                            <c:if test="${i.state==1}">
                                已激活
                            </c:if>
                            <c:if test="${i.state!=1}">
                                未激活
                            </c:if>
                        </td>
                        <td width="7%">
                            <c:if test="${i.code==1}">
                                管理员
                            </c:if>
                            <c:if test="${i.code!=1}">
                                常规用户
                            </c:if>
                        </td>
                        <td >
                            ${i.remark}
                        </td>
                        <td >
                            <a href="<%=request.getContextPath()%>/adminServlet?method=getOneUser&uid=${i.uid}" class="a_button_edit"></a>
                            <a href="<%=request.getContextPath()%>/adminServlet?method=delUser&uid=${i.uid}" class="a_button_del"></a>
                        </td>
                    </tr>
                </c:forEach>

            </table>
        </td>
    </tr>
    <tr align="center">
        <td id="pagination" colspan="7">
            <a href="<%=request.getContextPath()%>/adminServlet?method=allUser&pagenum=1">首页</a>|
            <c:if test="${adminuser.currentPage>1}">
                <a href="<%=request.getContextPath()%>/adminServlet?method=allUser&pagenum=${adminuser.currentPage-1}">上一页</a>|
            </c:if>
            <c:if test="${adminuser.currentPage<=1}">
                <a href="<%=request.getContextPath()%>/adminServlet?method=allUser&pagenum=1">上一页</a>|
            </c:if>

            <c:forEach begin="1" end="${adminuser.totalPage}" var="i" >
                <c:if test="${adminuser.currentPage==i}">
                    <a style="color: #985f0d;font-style: oblique" href="<%=request.getContextPath()%>/adminServlet?method=allUser&pagenum=${i}">${i}</a>
                </c:if>
                <c:if test="${adminuser.currentPage!=i}">
                    <a href="<%=request.getContextPath()%>/adminServlet?method=allUser&pagenum=${i}">${i}</a>
                </c:if>
            </c:forEach>

            <c:if test="${adminuser.currentPage<adminuser.totalPage}">
                <a href="<%=request.getContextPath()%>/adminServlet?method=allUser&pagenum=${adminuser.currentPage+1}">下一页</a>|
            </c:if>
            <c:if test="${adminuser.currentPage>=adminuser.totalPage}">
                <a href="<%=request.getContextPath()%>/adminServlet?method=allUser&pagenum=${adminuser.totalPage}">下一页</a>|
            </c:if>
            <a href="<%=request.getContextPath()%>/adminServlet?method=allUser&pagenum=${adminuser.totalPage}">尾页</a> |
            第${adminuser.currentPage}页/共${adminuser.totalPage}页/共${adminuser.totalCount}条

        </td>
    </tr>
    </tbody>
</table>
</body>
</html>
